﻿using UnityEngine;
using System.Collections;

public class ScreenBasedSpawner : MonoBehaviour {
	
	public int numberOFSpawns;
	public GameObject spawn;
	
	// Use this for initialization
	void Start () 
	{
		float zPos = camera.nearClipPlane;
		for(int i = 0; i < numberOFSpawns; i++)
		{
			
			Vector3 position = camera.ScreenToWorldPoint(ButterflyMovement.randomPosition());
			position.z = zPos;
			Instantiate(spawn, position, Quaternion.identity);
		}
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
